package com.ggb.reactive.repository

import com.ggb.reactive.domain.entity.Setmeal
import org.springframework.data.r2dbc.repository.Modifying
import org.springframework.data.r2dbc.repository.Query
import org.springframework.data.repository.reactive.ReactiveCrudRepository
import org.springframework.stereotype.Repository
import reactor.core.publisher.Flux
import reactor.core.publisher.Mono
import java.time.Instant

@Repository
interface SetmealRepository: ReactiveCrudRepository<Setmeal,Long> {
    @Modifying
    @Query("UPDATE setmeal SET status = :status,update_time = :updateTime,update_user = :updateUser  WHERE id = :id")
    fun updateStatusById(id: Long, status: Int, updateTime: Instant?, updateUser: Long): Mono<Long>
    fun findSetmealByCategoryId(categoryId: Long): Flux<Setmeal>


}